package com.yanghang.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@TableName("t_car")
public class Car {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String name;
    private Double price;
    private String speed;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createDate;
    @TableField("t_id")
    private int tid;
    @TableField(exist = false)
    private CarType ct;

    @Override
    public String toString() {
        return "Car{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", speed='" + speed + '\'' +
                ", createDate=" + createDate +
                ", tid=" + tid +
                ", ct=" + ct +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getSpeed() {
        return speed;
    }

    public void setSpeed(String speed) {
        this.speed = speed;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public int getTid() {
        return tid;
    }

    public void setTid(int tid) {
        this.tid = tid;
    }

    public CarType getCt() {
        return ct;
    }

    public void setCt(CarType ct) {
        this.ct = ct;
    }

    public Car(Integer id, String name, Double price, String speed, Date createDate, int tid, CarType ct) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.speed = speed;
        this.createDate = createDate;
        this.tid = tid;
        this.ct = ct;
    }

    public Car() {
    }
}
